package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.WxBean;
import com.lwj.liwanjia.impl.WxView;
import com.lwj.liwanjia.model.WxPayModel;

import java.util.Map;

import rx.Subscriber;

/**
 * Created by Administrator on 2017/11/15.
 */

public class WxPayPresenter {
    private WxView wxView;
    private WxPayModel wxPayModel;

    public WxPayPresenter(WxView wxView) {
        this.wxView = wxView;
        wxPayModel = new WxPayModel();
    }

    public void getWxPayInfo(Map<String, Object> map) {
        if (wxView != null) {
            wxPayModel.getWxPayInfo(map, new Subscriber<WxBean>() {
                @Override
                public void onCompleted() {

                }

                @Override
                public void onError(Throwable e) {
                    wxView.showError((Exception) e);
                }

                @Override
                public void onNext(WxBean wxBean) {
                    wxView.getWxPayInfo(wxBean);
                }
            });
        }
    }
}
